/*************************************************
*                                                *
*  EasyBMP Cross-Platform Windows Bitmap Library *
*                                                *
*  Author: Paul Macklin                          *
*   email: macklin01@users.sourceforge.net       *
* support: http://easybmp.sourceforge.net        *
*                                                *
*          file: EasyBMPsample.cpp               *
*    date added: 03-31-2006                      *
* date modified: 12-01-2006                      *
*       version: 1.06                            *
*                                                *
*   License: BSD (revised/modified)              *
* Copyright: 2005-6 by the EasyBMP Project       *
*                                                *
* description: Sample application to demonstrate *
*              some functions and capabilities   *
*                                                *
*************************************************/

#include "EasyBMP.h"

int main( int argc, char* argv[] )
{
    printf("\nUsing EasyBMP Version %s\n\n", _EasyBMP_Version_String_);
    printf("Copyright (c) by the EasyBMP Project 2005-6\n");
    printf("WWW: http://easybmp.sourceforge.net\n\n");

    BMP Text;
    Text.BMP_ReadFromFile("EasyBMPtext.bmp");

    BMP Background;
    Background.BMP_ReadFromFile("EasyBMPbackground.bmp");

    BMP Output;
    Output.BMP_SetSize( Background.BMP_TellWidth() , Background.BMP_TellHeight() );
    Output.BMP_SetBitDepth( 24 );

    EBMP_RangedPixelToPixelCopy( Background, 0, Output.BMP_TellWidth()-1,
                            Output.BMP_TellHeight()-1 , 0,
                            Output, 0,0 );

    EBMP_RangedPixelToPixelCopyTransparent( Text, 0, 380,
                                       43, 0,
                                       Output, 110,5,
                                       *Text(0,0) );

    EBMP_RangedPixelToPixelCopyTransparent( Text, 0, Text.BMP_TellWidth()-1,
                                       Text.BMP_TellWidth()-1, 50,
                                       Output, 100,442,
                                       *Text(0,49) );

    Output.BMP_SetBitDepth( 32 );
    printf("writing 32bpp ... \n");
    Output.BMP_WriteToFile( "EasyBMPoutput32bpp.bmp" );

    Output.BMP_SetBitDepth( 24 );
    printf("writing 24bpp ... \n");
    Output.BMP_WriteToFile( "EasyBMPoutput24bpp.bmp" );

    Output.BMP_SetBitDepth( 8 );
    printf("writing 8bpp ... \n");
    Output.BMP_WriteToFile( "EasyBMPoutput8bpp.bmp" );

    Output.BMP_SetBitDepth( 4 );
    printf("writing 4bpp ... \n");
    Output.BMP_WriteToFile( "EasyBMPoutput4bpp.bmp" );

    Output.BMP_SetBitDepth( 1 );
    printf("writing 1bpp ... \n");
    Output.BMP_WriteToFile( "EasyBMPoutput1bpp.bmp" );

    Output.BMP_SetBitDepth( 24 );
    EBMP_Rescale( Output, 'p' , 50 );
    printf("writing 24bpp scaled image ...\n");
    Output.BMP_WriteToFile( "EasyBMPoutput24bpp_rescaled.bmp" );

    return 0;
}
